import request from '../util/request/index.js'

// api地址
const apiUri = {
	login:'/login',//登录
	getTreeData:'/purchase/schoolRest/appSelectRest',
	getRest:'/purchase/schoolRest/list',
	getGoodsType:'/business/dishesType/list',
	getUserIfo:'/system/user/profile',
	getShopIfoByUserTel:'/business/userShop/listByParam',
	getGoods:'/business/dishes/list',//学生首页
	getGoodById:'/business/dishes/getInfoAll',//商品详情
	getshopIfo:'/business/userShop/',//店铺详情
	getCartSum:'/order/disheOrderCart/selectCount',//购物车角标
	cartList:'/order/disheOrderCart/list',//查询购物车
	shopList:'/business/dishes/listByParam',//店铺商品
	gysLogin:'/msuser/login',//商户登录
	getOpenid:'/user/getOpenid',//获取openid
	register:'/registerOrderUser',//注册
	addCart:'/order/disheOrderCart',//添加购物车
	updataCart:'/order/disheOrderCart',//更新购物车
	delCart:'/order/disheOrderCart/',//删除购物车
	updetaOpenid:'/user/updateOpenid',//更新openid
	cardUser:'/cardServCenter/cardUser/getInfoForApp/',//查询绑卡信息
	bindCard:'/cardServCenter/cardUser/appAddCardUser/',//用户绑卡
	lossCard:'/cardServCenter/physicalCard/',//挂失卡
	
}
export function gysloginByAccount(params) {
  return request(apiUri.gysLogin,"GET",params)
}
export function loginAcmont(params) {
  return request(apiUri.login,"POST",params)
}
export function queryOpenId(params) {
  return request.util.postData(apiUri.getOpenid, params)
}
export function resisterUser(params) {
  return request.util.reqData(apiUri.register, params)
}
export function saveCart(params) {
  return request.util.reqData(apiUri.addCart, params)
}
export function editCart(params) {
  return request.util.editData(apiUri.updataCart, params)
}
export function delCartData(params) {
  return request.util.removeData(apiUri.delCart+params)
}
export function editOpenId(params) {
  return request.util.postData(apiUri.updetaOpenid, params)
}
export function getSchoolAndRest(params) {
  return request(apiUri.getTreeData,"GET",params)
}
export function queryCartList(params) {
  return request.util.getData(apiUri.cartList, params)
}
export function getShopIfoBytel(params) {
  return request(apiUri.getShopIfoByUserTel, "GET",params)
}
export function getUserInfo(params) {
  return request(apiUri.getUserIfo, "GET",params)
}
export function getAllRest(params) {
  return request.util.getData(apiUri.getRest, params)
}
export function getGoodsByRant(params) {
  return request(apiUri.getGoods,"GET",params)
}
export function queryGoodsTypes(params) {
  return request(apiUri.getGoodsType,"GET",params)
}
export function queryShopList(params) {
  return request(apiUri.shopList,"GET",params)
}
export function queryGoodsOne(params) {
  return request(apiUri.getGoodById,"GET",params)
}
export function queryShopOne(params) {
  return request(apiUri.getshopIfo+params,"GET")
}
export function queryCardUser(params){
	return request.util.getData(apiUri.cardUser,params)
}
export function queryCardSum(params){
	return request.util.getData(apiUri.getCartSum,params)
}
export function bindCard(params){
	 return request.util.getData(apiUri.bindCard, params)
}
export function lossCard(params){
	return request.util.editData(apiUri.lossCard,params)
}